package spring2;

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import spring.IWriter;

public class IocData {
	private String str;
	private int count;
	private List list;
	private Set set;
	private Map map;

	// 构造方法注入
	private IWriter writer;
	private String message;

	public IWriter getWriter() {
		return writer;
	}

	public String getMessage() {
		return message;
	}

	public IocData(IWriter writer, String message) {
		this.writer = writer;
		this.message = message;
	}

	public String getStr() {
		return str;
	}

	public void setStr(String str) {
		this.str = str;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public List getList() {
		return list;
	}

	public void setList(List list) {
		this.list = list;
	}

	public Set getSet() {
		return set;
	}

	public void setSet(Set set) {
		this.set = set;
	}

	public Map getMap() {
		return map;
	}

	public void setMap(Map map) {
		this.map = map;
	}

	public static void main(String[] args) {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				"applicationContext.xml");
		IocData iocData = (IocData) context.getBean("iocData");
		
		System.out.println(iocData.getStr());
		System.out.println(iocData.getCount());
		System.out.println(iocData.getList());
		System.out.println(iocData.getSet());
		System.out.println(iocData.getMap());

		iocData.getWriter().save();
		System.out.println(iocData.getMessage());

	}

}
